#version 460
#extension GL_GOOGLE_include_directive : enable

layout(location = 0) in vec4 vColor;
layout(location = 1) in vec3 vNormal;
layout(location = 2) in vec3 vLightPos;
layout(location = 3) in float vWeigth;
 

layout(location=0) out vec4 outColor;





void main(void){
	float d = (dot(vLightPos, vNormal)) + 1.0;
	vec4 Color;

	if(vWeigth < 0.0f){
		Color.rgb = vec3(0,0,0);
	}
	else if(vWeigth < 0.2f){
		//Color.r = 0.5 * (1.0-vWeigth/0.2);
		Color.r = 0.0;
		Color.g = 0.0;
		Color.b = 0.5 + (0.5 * vWeigth/0.2);
	} else if (vWeigth >= 0.2 && vWeigth < 0.4){
		Color.r = 0.0;
		Color.g = 5.0 * (vWeigth-0.2);
		Color.b = 1.0;
	} else if(vWeigth >= 0.4 && vWeigth < 0.6){
		Color.r = 0.0;
		Color.g = 1.0 ;
		Color.b = 5.0 * (0.6 - vWeigth);
	} else if(vWeigth >= 0.6 && vWeigth < 0.8){
		Color.r = 5.0 * (vWeigth - 0.6);
		Color.g = 1.0 ;
		Color.b = 0.0;
	} else if(vWeigth >= 0.8 && vWeigth <= 1) {
		Color.r = 1.0;
		Color.g = 5.0 * (1.0 - vWeigth);
		Color.b = 0.0;
	} else {
		Color.rgb = vec3(1,1,1);
	}
	Color.a = 1.0;
	Color.rgb *= d;
	Color.rgb -= 0.3;

	outColor = Color;
	
}



